import React from 'react';
// 定义二级路由组件,用来存放左侧菜单项匹配到的组件
import { Route, Switch, Redirect } from 'react-router-dom'
import { lazy, Suspense } from 'react';
import Loading from '../components/Loading';
const Welcome = lazy(() => import('../views/dashboard/welcome'));
const Userlist = lazy(() => import('../views/dashboard/user'));
const Filmlist = lazy(() => import('../views/dashboard/film'));
const Cinemalist = lazy(() => import('../views/dashboard/cinema'))
const Collegelist = lazy(() => import('../views/dashboard/college'))
const Home = () => {
    return (
        <Suspense fallback={<Loading></Loading>}>
        <Switch>
            <Route path='/dashboard/welcome' component={Welcome}></Route>
            <Route path='/dashboard/user/index' component={Userlist}></Route>
            <Route path='/dashboard/film/index' component={Filmlist}></Route>
            <Route path='/dashboard/cinema/index' component={Cinemalist}></Route>
            <Route path='/dashboard/college/index' component={Collegelist}></Route>
            <Redirect from='/dashboard' to='/dashboard/welcome' exact></Redirect>
        </Switch>
    </Suspense>
    );
}

export default Home;
